@extends('common.base-master')

@section('html-head')
    <link rel="stylesheet" type="text/css" href="{{url('css/bootstrap.min.css')}}">
    <link href="{{url('css/cre-need.css')}}" type="text/css" rel="stylesheet">
    <script src="{{url('js/cre-need.js')}}"></script>
@endsection

@section('html-body')
    <main>
        <div class="wrapp">
            <div class="contain">
                <section class="cre-pro">
                    <h1>快速创建项目</h1>
                    <div class="head-line">
                        <p class="c-1 c-t"><em>1</em><i>项目信息</i></p>
                        <p class="c-1 c-t-s"><em>2</em><i>需求</i></p>
                        <p class="desc">
                            恭喜您已经成功创建项目，你希望通过旁观者平台获得什么？
                        </p>
                    </div>

                    <div class="table-box">
                        <ul>
                            <li><em class="pro-name"><em class="c-m">*</em><em class="c-name">您的需求</em></em><span  class="r-box"><em><input type="radio" name="r-need" checked="checked" />需要融资</em><em class="r-s"><input type="radio" name="r-need" class="r-need" />不需要融资</em></span></li>
                            <li><em class="error c-e-1">123</em></li>
                            <li class="left dis"><em class="pro-name"><em class="c-name c-money">融资金额</em></em><em class="c-i"><input type="text" class="money" placeholder="万" value=""/></em></li>
                            <li class="left"><em class="error c-e-2"></em></li>
                            <li class="left dis"><em class="pro-name"><em class="c-name c-stock">让出股份</em></em><em class="c-i"><input type="text" class="stock" placeholder="%" value="" /></em></li>
                            <li class="left"><em class="error c-e-3"></em></li>
                            <li class="left dis"><em class="pro-name c-p"><em class="c-name c-prospectus">商业计划书</em></em><em class="c-upbtn"><button id="upload_bp">点击上传</button><input type="hidden" id='file_id' value=""><em class="upload_msg" style="display: none;">上传文件...</em></em></li>
                            <li><em class="pro-name"><em class="c-m">*</em><em class="c-name">联系方式</em></em>
                                <div class="c-m-i c-m-f">
                                    <ul>
                                        <li><input type="text" placeholder="姓名" class="c-url real_name" value="{{$userinfo ? $userinfo->realname : ''}}" /></li>
                                        <li><em class="error i-e-c">123</em></li>
                                        <li><input type="text" placeholder="电话" class="i-url mobile" value="{{$user->phone}}" /></li>
                                        <li><em class="error i-e-i">123</em></li>
                                        <li><input type="text" placeholder="邮箱" class="a-url email"/></li>
                                        <li><em class="error i-e-a">123</em></li>
                                    </ul>
                                </div>
                            </li>

                            <li class="c-next"><button>完成创建</button></li>
                        </ul>
                    </div>
                </section>
            </div>
        </div>
    </main>
    <script type="text/javascript">
        var createProject = "{{route('Api.Project.EditProject',['id'=>$projectid])}}";
        var Home = "{{route('Home')}}";
        var uploader = new plupload.Uploader({
            runtimes: 'html5,flash,silverlight,html4',
            browse_button: 'upload_bp',
            url: '{{ url('api/upload/file')  }}',

       //     chunk_size: '40mb',
            filters: {
                max_file_size: '50mb',
                mime_types: [
    //                {title: "Image files", extensions: "jpg,gif,png"}
                ],
                prevent_duplicates: false
            },
            multi_selection: true,
            unique_names: true,

            flash_swf_url: '{{ url('vendor/plupload-2.1.2/Moxie.swf') }}',
            silverlight_xap_url: '{{ url('vendor/plupload-2.1.2/Moxie.xap') }}',

            file_data_name: 'file',
            headers: {
                Accept: 'application/json'
            },

            multipart_params: {
                _token: '{{ csrf_token() }}'
            },

            init: {
                PostInit: function () {
                },

                FilesAdded: function (up, files) {
                    up.start();
                },

                BeforeUpload: function (up, file) {
                    up.settings.multipart_params.file_name = file.name;
                    $('.upload_msg').show();
                },

                UploadProgress: function (up, file) {
                    $('.upload_msg').html('上传中...('+ file.percent + "%)");
                },

                Error: function (up, err) {
                    var responseObj = '', responseMessage = '';
                    try {
                        responseObj = $.parseJSON(err.response);
                        responseMessage = responseObj.message;
                    } catch ($e) {

                    }

                    noty({
                        type: 'error',
                        text: err.message + ' ' + responseMessage,
                        callback: {
                            afterClose: function () {
                                $('#inputImage').show();
                                $('#inputImageProgress').hide();
                            }
                        }
                    });
                },

                FileUploaded: function (up, file, info) {
                    var responseObj = '', responseMessage = '';
                    try {
                        responseObj = $.parseJSON(info.response);
                    } catch ($e) {

                    }
                    if (responseObj && responseObj.data) {
                        var $inputImage = $('.upload_msg');
                        var id = responseObj.data.id;
                        $('#file_id').val(id);
                        $inputImage.html("上传成功！<a href='/api/file/download/"+id+"'>【"+ responseObj.data.file_name+"】");
                        $inputImage.show();
                    }
                }
            }
        });
        uploader.init();
    </script>
@endsection